home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / networke / civ-0.000 / civ-0 / civ-0.3 / src / misc.h < prev    next >
C/C++ Source or Header  |  1995-02-16  |  454b  |  27 lines

  1. #ifndef _MISC_H
  2. #define _MISC_H
  3.  
  4. #include "mytypes.h"
  5. #include "list.h"
  6. #include <string.h>
  7.  
  8. class StrKey
  9. {
  10. public:
  11.   StrKey(char *ptr) { str = ptr; }
  12.   ~StrKey() {}
  13.  
  14.   int operator==(StrKey &key) { return strcmp(str, key.str) == 0; }
  15.   unsigned long HashValue() {
  16.     unsigned long hash = 0;
  17.     for (char *ptr = str; *ptr; ++ptr) hash = (hash<<1)^*ptr;
  18.     return hash;
  19.   }
  20.  
  21.   char *str;
  22. };
  23.  
  24. void AddMessage(List<charp> &l, char *format, ...);
  25.  
  26. #endif
  27.